package com.wjf.accesscontrol.ui.setting.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.wjf.accesscontrol.R
import com.wjf.accesscontrol.entity.ActivateEntity

/**
 * @Description
 * @Author WuJianFeng
 * @Date 2024/2/1 17:47
 *
 */

class ActivateAdapter(private val dates: List<ActivateEntity>) : RecyclerView.Adapter<ActivateAdapter.ActivateViewHolder>() {


    private lateinit var mView: View
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ActivateViewHolder {
        mView = LayoutInflater.from(parent.context).inflate(R.layout.item_activate,parent,false)
        return ActivateViewHolder(mView)
    }

    override fun getItemCount() = dates.size

    override fun onBindViewHolder(holder: ActivateViewHolder, position: Int) {
        holder.tvPre.text = dates[position].pre
        holder.tvContent.text = dates[position].content
    }

    inner class ActivateViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
        val tvPre: TextView = itemView.findViewById(R.id.tv_pre)
        val tvContent: TextView = itemView.findViewById(R.id.tv_content)

    }
}